/**
 * Created by Administrator on 2017/4/6.
 */
window.onload=function () {
    var og=document.getElementById('canvas');
    var ogc=og.getContext('2d');
    og.onmousedown=function (ev) {
         ev= ev || window.event;
        ogc.moveTo(ev.clientX-og.offsetLeft,ev.clientY-og.offsetTop);
        document.onmousemove=function (ev) {
            ogc.lineTo(ev.clientX-og.offsetLeft,ev.clientY-og.offsetTop);
            ogc.stroke();
        };
        document.onmouseup=function () {
            document.onmousemove=null;
            document.onmouseup=null;
        }
    }
};